Archi's Academy

GetStarted

GetStarted
Get in touch

Blockchain

Computer Networking

As you know one of the most popular Ethereum tokens is ERC20.

But what is ERC20?

The ERC-20 Ethereum token standard is a blueprint for creating fungible tokens that are compatible with the broader Ethereum network. The most important feature of ERC20 is that tokens are fungible. This means that each token is equal to all the other tokens like BNB, USDT. (Other ERC20 tokens)

Smart Contracts in Ethereum are immutable by default. If we want to make changes to our contract in the future, we may want to use the Upgradeable Contract feature. There are many advantages of making the contract upgradeable instead of deploying a new contract. As we create and deploy a new contract, the contract address will change. So you will need to update all contracts that interacted with the old contract to use the address of the new version. You will also have to reach out to all of your users and convince them to start using the new contract and handle both contracts being used simultaneously, as users are slow to migrate.

We can use a proxy contract with an interface where each method delegates to the implementation contract.

et.png

The first contract is a simple wrapper or “proxy” with which users interact directly and is in charge of forwarding transactions to and from the second contract, which contains the logic. The key concept to understand is that the logic contract can be replaced while the proxy or the access point is never changed. Both contracts are still immutable in the sense that their code cannot be changed, but the logic contract can simply be swapped by another contract. The wrapper can thus point to different logic implementation and in doing so, the software is “upgraded”.

Whenever you deploy a new contract using deploy proxy in the OpenZeppelin Upgrades Plugins, that contract instance can be upgraded later.By default, only the address that originally deployed the contract has the rights to upgrade it.

Here is a sample upgradeable smart contract, you can download the full project from the here and modify it according to your project.

archis-trainee

Seher Saylık

Friday, Apr 2, 2021